<template>
<view class="content">
    <view class="shop-card" v-for="shop in shops" :key="shop.id" @click="shopclick(shop._id)">
        <view class="shop-logo">
            <image :src="`/static/${shop.imgUrl}`" mode="aspectFit" />
            <view v-if="shop.tag" class="shop-tag">{{shop.tag}}</view>
        </view>
        <view class="shop-info">
            <view class="shop-name">{{shop.name}}</view>
            <view class="shop-details">
                <text>月售 {{shop.sales}}</text>
                <text>起送¥{{shop.expressLimit}}</text>
                <text>运费¥{{shop.expressPrice}}</text>
            </view>
            <view class="shop-promotion">{{shop.slogan}}</view>
        </view>
    </view>
</view>   
</template>
<script>
import Config from '@/Config.js'

export default {
	data() {
      return {
       shops: [],
      }
    },
	onLoad(options) {
		this.showdata()
    },
    methods: {
      showdata(id) {
         uni.request({
           url: `${Config.URL}hotList`,
           success: (res) => {
              this.shops = res.data
           },
        })
      },
	  shopclick(id) {
	  console.log(id)
      uni.navigateTo({
        url:`/pages/detail/detail?id=${id}`,
      });
    }
    }
	
};
</script>


<style scoped>
.content {
    padding: 10px;
}

.shop-card {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.shop-logo {
    position: relative;
    width: 80px;
    height: 80px;
    margin-right: 15px;
}

.shop-logo image {
    width: 100%;
    height: 100%;
    border-radius: 4px;
}

.shop-tag {
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    background: #ff4d4f;
    color: white;
    font-size: 12px;
    padding: 2px 4px;
    text-align: center;
    border-radius: 2px;
}

.shop-info {
    flex: 1;
}

.shop-name {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.shop-details {
    display: flex;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.shop-details text {
    margin-right: 15px;
}

.shop-promotion {
    color: #ff4d4f;
    font-size: 12px;
}
</style>